from selenium.webdriver.common.by import By

from Hogwarts.Homeworks.hw0627.page_objects.base_page import BasePage

"""
PAGE：录入部门信息
"""


class AddDeptPage(BasePage):

    _INPUT_DEPT_NAME = (By.CSS_SELECTOR, "div:nth-child(1) > input")
    _BTN_CONFIRM = (By.XPATH, '//*[@id="__dialog__MNDialog__"]/div/div[3]/a[1]')

    def edit_dept(self, dept_name):
        """
        录入部门信息
        :return:
        """
        from Hogwarts.Homeworks.hw0627.page_objects.contact_page import ContactPage

        self.find(*self._INPUT_DEPT_NAME).send_keys(dept_name)
        self.find_and_click(*self._BTN_CONFIRM)

        return ContactPage(self.driver)
